package com.lh.controller;

import com.alibaba.fastjson.JSONObject;
import com.lh.entity.table.Task1Info;
import com.lh.entity.table.Task2Info;
import com.lh.entity.table.TaskInfo;
import com.lh.service.TaskService;
import com.lh.utils.Answer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Task")
public class TaskController {

    @Autowired
    private TaskService taskService;

    @RequestMapping("/addTask")
    public Answer<Object> addTask(@RequestBody TaskInfo taskInfo) {
        return taskService.addTask(taskInfo);
    }

    @RequestMapping("/updateTask")
    public Answer<Object> updateTask(@RequestBody TaskInfo taskInfo) {
        return taskService.updateTask(taskInfo);
    }

    @RequestMapping("/deleteTask")
    public Answer<Object> deleteTask(@RequestBody TaskInfo taskInfo) {
        return taskService.deleteTask(taskInfo);
    }

    @RequestMapping("/selectTaskList")
    public Answer<Object> selectTaskList(@RequestBody TaskInfo taskInfo) {
        return taskService.selectTaskList(taskInfo);
    }

    @RequestMapping("/addTask1")
    public Answer<Object> addTask1(@RequestBody Task1Info task1Info) {
        return taskService.addTask1(task1Info);
    }

    @RequestMapping("/updateTask1")
    public Answer<Object> updateTask1(@RequestBody Task1Info task1Info) {
        return taskService.updateTask1(task1Info);
    }

    @RequestMapping("/deleteTask1")
    public Answer<Object> deleteTask1(@RequestBody Task1Info task1Info) {
        return taskService.deleteTask1(task1Info);
    }

    @RequestMapping("/selectTask1List")
    public Answer<Object> selectTask1List(@RequestBody Task1Info task1Info) {
        return taskService.selectTask1List(task1Info);
    }

    @RequestMapping("/addTask2")
    public Answer<Object> addTask2(@RequestBody Task2Info task2Info) {
        return taskService.addTask2(task2Info);
    }

    @RequestMapping("/updateTask2")
    public Answer<Object> updateTask2(@RequestBody Task2Info task2Info) {
        return taskService.updateTask2(task2Info);
    }

    @RequestMapping("/deleteTask2")
    public Answer<Object> deleteTask2(@RequestBody Task2Info task2Info) {
        return taskService.deleteTask2(task2Info);
    }

    @RequestMapping("/selectTask2List")
    public Answer<Object> selectTask2List(@RequestBody Task2Info task2Info) {
        return taskService.selectTask2List(task2Info);
    }

    @RequestMapping("/queryTask2Progress")
    public Answer<Object> queryTask2Progress(@RequestBody JSONObject reqJson) {
        return taskService.queryTask2Progress(reqJson);
    }
}
